package jp.tkym.labs.gwt.client;

import jp.tkym.labs.geom.Vector3f;
import jp.tkym.labs.m3d.Camera3D;
import jp.tkym.labs.m3d.DeviceTranslator;
import jp.tkym.labs.m3d.Line3D;
import jp.tkym.labs.m3d.Modeling3D;
import jp.tkym.labs.m3d.ProjectionTranslator;
import jp.tkym.labs.m3d.Text3D;

import com.google.gwt.core.client.EntryPoint;

public class Gwd3d implements EntryPoint{
	public void onModuleLoad() {
		// calculate 
		Modeling3D modeling = new Modeling3D();
		Camera3D camera = modeling
				.on("v1")
				.addY(-50.0f)
				.rotateBeta((float) (-Math.PI / 2))
				.camera(new DeviceTranslator(800, 600),
						ProjectionTranslator.createByRatio(
								(double) (5.0d / 3.0d), 800.0f / 600.0f));
		float len = 50.0f;

		Vector3f x = new Vector3f(len, 0.0f, 0.0f);
		Vector3f y = new Vector3f(0.0f, len, 0.0f);
		Vector3f z = new Vector3f(0.0f, 0.0f, len);
		Vector3f o = new Vector3f();
		
		modeling.on("p0").addZ(-25.0f).addX(-25.0f)
				.add(new Line3D(o, x))
				.add(new Line3D(o, y))
				.add(new Line3D(o, z))
				.add(new Text3D("x", x))
				.add(new Text3D("y", y))
				.add(new Text3D("z", z));
		
	}
}
